package com.jianyushe.gof23.learncode.creationalpattern.builder;

/**
 * @author Create by Alvin
 * @Description TODO
 * @date 2021-10-13 14:25
 */
public class AirshipDirectorImpl implements AirshipDirector{
    private AirshipBuilder airshipBuilder;

    public AirshipDirectorImpl(AirshipBuilder airshipBuilder) {
        this.airshipBuilder = airshipBuilder;
    }
    /**
     * 先建造再组建
     * @return Airship
     */
    @Override
    public Airship directorAirship() {
        Engine engine = airshipBuilder.builderEngine();
        OrbitalModule orbitalModule = airshipBuilder.builderOrbitalModule();
        EscapeTower escapeTower = airshipBuilder.builderEscapeTower();

        Airship airship = new Airship();
        airship.setEngine(engine);
        airship.setOrbitalModule(orbitalModule);
        airship.setEscapeTower(escapeTower);

        return airship;
    }
}
